﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xyz.Service;
using Xyz.Service.DataTransferObjects;
using System.Web.Security;

namespace Xyz.Web.Admin.Account
{
    public partial class Login : System.Web.UI.Page
    {
        AdministratorService adminService = new AdministratorService();
 
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }

        protected void btn_LogIn_Click(object sender, EventArgs e)
        {
            string loginId = txt_UserName.Text;
            string password = txt_Password.Text;

            if (adminService.GetAdministrator(loginId, password) != null)
            {
                lblErrorMessage.Visible = false;
                FormsAuthentication.SetAuthCookie(loginId, false);
                Response.Redirect("../Flight/SearchFlightSchedule.aspx");
            }
            else
            {
                lblErrorMessage.Visible = true;
            }
        }
    }
}
